package info.manxi;

import akka.actor.ActorRef;
import akka.actor.ActorSystem;
import akka.actor.Inbox;

import java.time.Duration;
import java.util.concurrent.TimeoutException;

/**
 * Hello world!
 */
public final class App {
    private App() {
    }

    /**
     * Says hello to the world.
     * 
     * @param args The arguments of the program.
     */
    public static void main(String[] args) throws InterruptedException, TimeoutException {
        ActorSystem system = ActorSystem.create("www-manxi-info");
        System.out.println(system);

        ActorRef 少年维特 = system.actorOf(Boy.props(), "shaonianweite");

        Inbox inbox = Inbox.create(system);
        inbox.watch(少年维特);
        inbox.send(少年维特, 1);
        inbox.send(少年维特, "");

        while (true) {
            System.out.println("start。。。");
            Object receive = inbox.receive(Duration.ofMillis(10));
            System.out.println(receive);
        }
    }
}
